<template>
	<view style="background-color: #FFFFFF;height: 100vh;">
		



		<view style="display: flex;padding: 20rpx 20rpx;border-bottom: 1rpx solid #F0F0F0;" v-for="(item,index) in data" @tap="goDetail(item.good_id)">
			<view class="btnLeftView">
				<image :src="item.picture" style="width: 100%;height: 100%;"></image>
			</view>
			<view style="margin-left: 30rpx;width: 70%;">
				<view style="display: flex;justify-content: space-between;">
					<view class="btnLeftViewFont" style="margin-right: 22px;">{{item.goods_name}}</view>
				</view>

				<view style="display: flex;justify-content: space-between;margin-top: 10px;">
					<view class="moneyFont">库存{{item.stock}}</view>
				</view>
				<!-- <view style="display: flex;flex-direction:row-reverse" @tap="goStock(item.gm_id,item.stock)">
					<view style="background-color: #1FDCA9;width: 80rpx;color: #FFFFFF;display: flex;justify-content: center;align-items: center;font-size: 12rpx;">退库</view>
				</view> -->
			</view>
			

		</view>
		
		<view>
			<neil-modal :show="showModel" @close="showModel=false" title="请输入退库数量" @cancel="showModel=false"
				@confirm="confirm">
				<view class="input-view">
					<view class="input-name">
						<view>数量</view>
						<input type="text" placeholder="请输入数量" v-model="stockSum" />
					</view>
					
				</view>
			</neil-modal>
		</view>
		
	</view>
</template>

<script>
	import http from 'common/js/http.js';
	import neilModal from '@/components/neil-modal/neil-modal.vue';
	export default {
		components: {
			neilModal
		},
		data() {
			return {
			data:[],
			showModel: false,
			stockSum:'',
			stock:''
			}
		},

		onShow() {
			
			this.getList()

		},
		mixins: [http],
		methods: {
			
			goDetail(e){
				uni.navigateTo({
					url:'/pages/member/purchase/purchaseDetail?id='+e
				})
			},
			goStock(e,stock){
				this.showModel=!this.showModel
				this.gmId=e
				this.stock=stock
			},
			
			confirm() {
				
				// if(this.stockSum>this.stock){
				// 	uni.showToast({
				// 		title:'没有那么多库存',
				// 		icon:'none'
				// 	})
				// 	return
				// }
				this.sendRequest({
					url: 'System.Order.tuiStock',
					data:{
						stockSum:this.stockSum,
						gm_id:this.gmId
					},
					success: res => {
						
						this.stockSum=""
					}
				});
			},
			getList(){
				this.sendRequest({
					url: 'System.Order.goodsMember',
					success: res => {
						this.data=res.data
						console.log(this.data)
					}
				});
			}
		}
	}
</script>

<style>
	.input-name,
	.input-password {
		height: 80upx;
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		position: relative;
		padding-left: 30upx;
		box-sizing: border-box;
	}
	
	.input-name::after {
		content: " ";
		position: absolute;
		left: 30upx;
		bottom: 0;
		right: 0;
		height: 1px;
		border-top: 1px solid #e5e5e5;
		transform-origin: 0 0;
		transform: scaleY(.5);
	}
	
	.input-name view,
	.input-password view {
		width: 120upx;
		height: 50upx;
		line-height: 50upx;
		font-size: 28upx;
		color: #333333;
	}
	
	.input-name input,
	.input-password input {
		flex: 1;
		height: 50upx;
		line-height: 50upx;
	}
	.queding {
		color: #FFFFFF;
		width: 120rpx;
		height: 40rpx;
		background: #1FDCA9;
		border: 1rpx solid #FFF7F8;
		border-radius: 18rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 20rpx;
		font-size: 24rpx;
	}

	.minus {
		border: 1px solid #1FDCA9;
		color: #1FDCA9;
		width: 30rpx;
		height: 30rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.add {
		border: 1px solid #1FDCA9;
		color: #1FDCA9;
		width: 30rpx;
		height: 30rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.Bonus {
		width: 150rpx;
		height: 40rpx;
		background: #1FDCA9;
		border: 1rpx solid #FFF7F8;
		border-radius: 18rpx;
		font-size: 24rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.moneyFont {
		font-size: 24rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #1E1E1E;

	}

	.btnLeftViewFont {
		font-size: 30rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #1E1E1E;
	}

	.btnLeftView {
		width: 30%;
		height: 187rpx;
		margin-left: 45rpx;
	}

	.classify {
		font-size: 22rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: #1FDCA9;
		paddding-top: 10rpx;
	}

	.searchView {
		width: 660rpx;
		height: 70rpx;
		background: #F4F4F4;
		border-radius: 5rpx;
		margin: 0 auto;
		display: flex;
		align-items: center;
		justify-content: space-around;
		margin-top: 20rpx;
	}
</style>
